package com.andy.basics;

import java.util.Locale;

import org.springframework.context.MessageSource;
import org.springframework.context.MessageSourceAware;
import org.springframework.stereotype.Component;

@Component
public class Messages extends AbstractMap implements MessageSourceAware {

	private MessageSource messageSource;

	@Override
	public String get(final Object key) {
		return this.messageSource.getMessage(key.toString(), null,
				Locale.getDefault());
	}

	public void setMessageSource(final MessageSource messageSource) {
		this.messageSource = messageSource;
	}

}
